home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_dev-disk / egsincludes / egsintui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-06  |  51.5 KB  |  1,322 lines

  1. #ifndef EGS_EGSINTUI_H
  2. #define EGS_EGSINTUI_H
  3.  
  4. /***************************************************************************\
  5. *
  6. *  $
  7. *  $ FILE     : egsintui.h
  8. *  $ VERSION  : 1
  9. *  $ REVISION : 8
  10. *  $ DATE     : 08-Dec-93 12:45
  11. *  $
  12. *  $ Author   : mvk
  13. *  $
  14. *
  15. *****************************************************************************
  16. *                                                                           *
  17. * (c) Copyright 1990/94 VIONA Development                                   *
  18. *     All Rights Reserved                                                   *
  19. *                                                                           *
  20. \***************************************************************************/
  21.  
  22.  
  23. #ifndef         EXEC_TYPES_H
  24. #include        <exec/types.h>
  25. #endif
  26. #ifndef         EXEC_PORTS_H
  27. #include        <exec/ports.h>
  28. #endif
  29. #ifndef         DEVICES_INPUTEVENT_H
  30. #include        <devices/inputevent.h>
  31. #endif
  32. #ifndef         GRAPHICS_TEXT_H
  33. #include        <graphics/text.h>
  34. #endif
  35. #ifndef         EGS_EGS_H
  36. #include        <egs/egs.h>
  37. #endif
  38. #ifndef         EGS_EGSBLIT_H
  39. #include        <egs/egsblit.h>
  40. #endif
  41. #ifndef         EGS_EGSLAYERS_H
  42. #include        <egs/egslayers.h>
  43. #endif
  44. #ifndef         EGS_EGSGFX_H
  45. #include        <egs/egsgfx.h>
  46. #endif
  47. #ifndef         EGS_EGSINTUIGFX_H
  48. #include        <egs/egsintuigfx.h>
  49. #endif
  50.  
  51.  
  52. /*
  53.  * This library implements a complete window system with menus, gadgets etc.
  54.  * It uses only the other EGS libraries and is thus implementable for other
  55.  * graphic boards e. g. the GVP EGS-110/24. The library works as indepen-
  56.  * dent from the current graphic mode as possible.
  57.  *
  58.  * The basic structure of the system resembles Commodore's Intuition library.
  59.  * Most names and structures derive from it but are sometimes modified a
  60.  * great deal.
  61.  *
  62.  * The library uses an extended EGS screen type to give you the choice of
  63.  * whether to use the window system or not.
  64.  *
  65.  * All graphics drawing (windows, gadget and menus) is carried out by IntuiGfx
  66.  * stack programs (refer to "egsintuigfx.h") which is the most significant
  67.  * difference to the Commodore library.  he reasons for this technique is the
  68.  * clumsy implementation of Intuition graphics in Commodore's library (three
  69.  * lists, no multiple usage of the structures, waste of memory by overloaded
  70.  * structures and lacking flexibility). The IntuiGfx solution is so flexible
  71.  * that even the knobs of PropGadets are realised by such a program; even the
  72.  * graphics for window borders is driven by IntuiGfx programs.
  73.  *
  74.  * Unless you use the EGSGadBox library, it is recommended to use
  75.  * "GimmeZeroZero" windows as the overhead is not that gigantic in contrast
  76.  * to Commodore's implementation. However, using a ClipRect (see EGSGfx's
  77.  * EG_InstallClipRect, the same effect can be achieved.
  78.  *
  79.  * Requesters are not implemented in the library since all requesters are in
  80.  * fact windows, and the overhead for an extra structure does not pay.
  81.  *
  82.  * Menus have two new features: they can "hang" at the window border and they
  83.  * can be teared off and then stay open. The advantage is that the menu way
  84.  * is minimized and often-used menus are accessible directly.
  85.  *
  86.  */
  87.  
  88. typedef struct EI_Window *EI_WindowPtr;
  89. typedef struct EI_EIntuiMsg *EI_EIntuiMsgPtr;
  90.  
  91.  
  92. /*
  93.  * Menus
  94.  *
  95.  * Menus serve to invoke an action or modify a state. Menus pop up by
  96.  * pressing the right mouse button and appear at the screen or the window
  97.  * title. A menu item is selected by moving the pointer over it while
  98.  * pressing the right mouse button and releasing the button over it (alter-
  99.  * natively "toggleSelect" menu items can be flipped by shortly pressing the
  100.  * left mouse button).
  101.  *
  102.  * A menu item can have submenus which open when the item is reached with the
  103.  * mouse pointer and which can then be selected. This nesting is infinite
  104.  * but should not be exaggerated.
  105.  *
  106.  * You can tear off menus, i.e. they stay open even after you released the
  107.  * right mouse button. This is performed by a special menu item. These open
  108.  * menus can be selected with the right mouse button and moved with the left
  109.  * one.
  110.  *
  111.  *---------------------------------------------------------------------------
  112.  *
  113.  * Structures:
  114.  *
  115.  * Menu, MenuPtr
  116.  *
  117.  *   .ItemMaster : Pointer to menu item the menu of which is this menu's super
  118.  *                 menu. NULL if this menu is the main menu.
  119.  *   .MenuMaster : Pointer to menu that is this menu's super menu. NULL if
  120.  *                 this menu is the main menu.
  121.  *   .FirstItem  : Pointer to the first menu item of this menu.
  122.  *   .LeftEdge,
  123.  *   .TopEdge    : Coordinates of the menu relative to the super menu or
  124.  *                 title bar.
  125.  *   .Width,
  126.  *   .Height     : Menu's size that determines the background that is saved
  127.  *                 when the menu is displayed. This means the size should at
  128.  *                 least contain the menu with all its menu items but also
  129.  *                 should not exceed that area to save memory.
  130.  *
  131.  *   .Border     : Render program for the basic menu structure without items.
  132.  *                 This stack program is passed over the width (in FP+1) and
  133.  *                 height (in FP+0) of the menu so that it can be used for
  134.  *                 all menus. This routine should also clear the background
  135.  *                 of the menu.
  136.  *
  137.  *  MenuItem, MenuItemPtr
  138.  *
  139.  *   .Prev,
  140.  *   .Next          : Menu item chaining; the first and last menu item
  141.  *                    contain NULL in the corresponding field.
  142.  *   .LeftEdge,
  143.  *   .TopEgde       : Coordinates of the item's top left corner, relative to
  144.  *                    its menu.
  145.  *   .Width,
  146.  *   .Height        : Item's size.
  147.  *
  148.  *   .Active        : Render program if the item is active.
  149.  *
  150.  *   .Passive       : Render program if the item is passive. If this routine
  151.  *                    is NULL the library uses a ghosting feature to show
  152.  *                    unselectable items. The your rendering prg is called by
  153.  *                    EI_GadgetOff if you put a IntuiGfx-Prg in the
  154.  *                    Passive place.
  155.  *
  156.  *   .CheckMark     : Render program if the item is selected for
  157.  *                    "ToggleSelect".
  158.  *
  159.  *   .Select        : Render program executed when the item is active and
  160.  *                    the mouse touches it. The program is passed over the
  161.  *                    width (in FP+1) and height (in FP+0) of the item so
  162.  *                    that all items can share the same program.
  163.  *
  164.  *   .Release       : Render program called when the mouse leaves the item.
  165.  *                    The program is passed over the item size, too.  It is
  166.  *                    called even when the menu is drawn so that the normal
  167.  *                    render programs need not draw the graphics for "not
  168.  *                    selected".
  169.  *
  170.  *                    If you use Release and Select the gadget flags
  171.  *                    STD_COMPLEMENT and STD_HIGHLIGHT should be not set.
  172.  *
  173.  *   .Flags         : Flags of the item:
  174.  *
  175.  *     - MENU_ACTIVE    : Item is active and selectable.
  176.  *     - MENU_SELECTED  : Item is selected; for items that can be switched on
  177.  *                        and off.
  178.  *     - MENU_SELECTABLE: Item is selectable.
  179.  *     - MENU_TOGGLE    : Items toggles its state each time when selected.
  180.  *     - MENU_LEAVE     : Item causes no message but the menu containing this
  181.  *                        item is teared off.
  182.  *
  183.  *   .ID            : Number of the item; is passed over as "code" of the
  184.  *                    EIDCMP message. The advantage is that for inserting
  185.  *                    new items the message for old items does not change.
  186.  *   .SubMenu       : Submenu, NULL if missing.
  187.  *   .MutualExclude : Set of items that are to be deselected if this item is
  188.  *                    selected. For those items no extra message is sent.
  189.  *   .MutualInclude : Set of items that are to be selected if this item is
  190.  *                    selected. For those items no extra message is sent.
  191.  *   .HotKey        : ASCII-Code selecting this item when pressed together
  192.  *                    with the right Amiga key
  193.  *
  194.  *
  195.  * The menu structure is practically only the drawing area on which items are
  196.  * located. A title bar as for Commodore's Intuition should be designed such
  197.  * that the main menu is as wide as the title bar, and each menu title is an
  198.  * item of this main menu. The real menus are then logical submenus of that
  199.  * title bar main menu. Then a Commodore Intuition menu with submenus (e.g.
  200.  * Project.Load.IFFPicture) has really two submenus in the EGSIntui library.
  201.  * For pop up menus it might be better to start with a real vertical
  202.  * oriented menu.
  203.  *
  204.  */
  205.  
  206. /* Corresponding MenuItemFlagSet has 16 bits ! */
  207.  
  208. #define EI_MENU_ACTIVE     1
  209. #define EI_MENU_SELECTED   2
  210. #define EI_MENU_SELECTABLE 4
  211. #define EI_MENU_TOGGLE     8
  212. #define EI_MENU_MOUSED     16
  213. #define EI_MENU_MOVE       32
  214. #define EI_MENU_LEAVE      64
  215.  
  216. typedef struct EI_Menu *EI_MenuPtr;
  217. typedef struct EI_MenuItem *EI_MenuItemPtr;
  218.  
  219. struct EI_Menu {
  220.  
  221.              EI_MenuPtr         WinPrev, WinNext;
  222.              EI_MenuItemPtr     ItemMaster;
  223.              EI_MenuPtr         MenuMaster;
  224.              EI_MenuItemPtr     FirstItem;
  225.              WORD               LeftEdge,TopEdge,
  226.                                 Width, Height;
  227.  
  228.              IG_IntuiGfxPtr     Border;
  229.              E_EBitMapPtr       BackSave;
  230.              EL_LayerPtr        Layer;
  231.              EG_RastPortPtr     Rast;
  232. };
  233.  
  234. struct EI_MenuItem {
  235.  
  236.              EI_MenuItemPtr  Prev, Next;
  237.              WORD            LeftEdge, TopEdge, Width, Height;
  238.              IG_IntuiGfxPtr  Active, Passive,
  239.                              CheckMark, Select, Release;
  240.              UWORD           Flags;
  241.              UWORD           Pad0;
  242.              LONG            ID;
  243.              EI_MenuPtr      SubMenu;
  244.              ULONG           MutualExclude, MutualInclude;
  245.              BYTE            Pad1;
  246.              char            HotKey;
  247.              UWORD           Pad2;
  248. };       
  249.  
  250.  
  251.  
  252. /*
  253.  * Gadgets are window elements that the user can click on and thereby give
  254.  * the application information. There are six kinds of gadgets:
  255.  *
  256.  *   - ActionGadget  : When pressing the gadget the program gets a message.
  257.  *                     This gadget can only be selected.
  258.  *
  259.  *   - BoolGadget    : By pressing this gadget a flag is toggled from TRUE to
  260.  *                     FALSE and vice versa. With such gadgets flags can be
  261.  *                     requested. You can choose whether or not you want a
  262.  *                     message when the gadget is selected.
  263.  *
  264.  *   - StringGadget  : In these gadgets you can have a string edited, e.g.
  265.  *                     file names. The library offers some editing capabili-
  266.  *                     ties which need not be implemented. If required, you
  267.  *                     can get a message when the gadget is entered and/or
  268.  *                     left.
  269.  *
  270.  *   - PropGadget    : With these gadget a numerical value can be changed.
  271.  *                     For that a knob in a rectangle is created which can be
  272.  *                     moved with the mouse. Its position indicates the
  273.  *                     value, and its size represents the ratio of its value
  274.  *                     and the maximum number possible. You can get messages
  275.  *                     when the gadget is selected, moved and/or left.
  276.  *                     Move message should be used only if your program can
  277.  *                     cope with the amount of messages arriving.
  278.  *
  279.  *   - IntegerGadget : This is an extended string gadget allowing only
  280.  *                     editing of an integer number.
  281.  *
  282.  *   - RealGadget    : Like an integer gadget but for IEEE double precision
  283.  *                     numbers.
  284.  *
  285.  *   - UserDefGadget : A gadget that calls user functions on activation,
  286.  *                     release and on any requested IDCMP event that
  287.  *                     occurs in between.
  288.  *
  289.  *   - MasterGadget  : A gadget that serves as handle for several other gadgets
  290.  *                     that are linked to it. Gadget operations that are
  291.  *                     executed for the master gadget are also recursivly
  292.  *                     called for all its son gadgets. By using the callback
  293.  *                     feature in the gadget structure, one can even build
  294.  *                     complex gadgets, consisting of several normal gadgets,
  295.  *                     but appearing as being one normal gadget.
  296.  *                     See also "egsgadbox..." for examples and more
  297.  *                     information.
  298.  *
  299.  *---------------------------------------------------------------------------
  300.  *
  301.  * Structures:
  302.  *
  303.  * All gadgets own the same basic structure and have then additional elements
  304.  * depending on their type.
  305.  *
  306.  * Gadget, GadgetPtr
  307.  *
  308.  *   .Prev,
  309.  *   .Next          : Chaining of the gadgets, the first and last element of
  310.  *                    a list always point to NULL.
  311.  *   .LeftEdge,
  312.  *   .TopEgde       : Coordinates of the top left corner.
  313.  *   .Width,
  314.  *   .Height        : Gadget size.
  315.  *   .Id            : Identification number.
  316.  *   .Active        : Render program drawing the gadget if it is active.
  317.  *   .Passive       : Render program drawing the gadget if it is passive.
  318.  *                    If this routine is NULL the library uses a ghosting
  319.  *                    mechanism for displaying deactivated gadgets.
  320.  *   .Select        : Render program executed when the gadget is selected.
  321.  *                    The program is passed over the width (in FP+1) and
  322.  *                    height (in FP+0) of the item so that several gadgets
  323.  *                    can share the same program. If it is a PropGadget then
  324.  *                    the size of the KNOB (in FP+0) or the height of the
  325.  *                    knob for vertical PropGadget (in FP+0) is passed over !
  326.  *   .Release       : Render program called when the gadget is released.
  327.  *                    The program is passed over the item size, too. It is
  328.  *                    called even when the gadget is drawn so that at the
  329.  *                    beginning it is deselected. For PropGadgets this programm
  330.  *                    is called for the KNOB when the gadget is passive.
  331.  *
  332.  *   .Flags         : Gadget flags.
  333.  *
  334.  *     - GADGET_BORDER   : Gadget is in the window border.
  335.  *     - REL_RIGHT       : Gadget coordinates are relative to the right window
  336.  *                         border.
  337.  *     - REL_BOTTOM      : Gadget coordinates are relative to the bottom
  338.  *                         window border.
  339.  *     - SYS_GADGET      : It is a system gadget.
  340.  *     - GADGET_SELECTED : Gadget is currently selected.
  341.  *     - REL_VERIFY      : Gadget sends message only if the pointer was over
  342.  *                         it when the mouse button was released.
  343.  *     - GADGET_IMMEDIATE: Gadget sends message as soon as clicked onto.
  344.  *     - TOGGLE_SELECT   : For bool gadgets, the gadget toggles its state each
  345.  *                         time selected.
  346.  *     - REPEAT_GADGET   : As long as pressed, the gadget sends messages in
  347.  *                         short intervals.
  348.  *     - GADGET_INACTIVE : Gadget cannot be selected.
  349.  *
  350.  *     - STD_COMPLEMENT  : Gadget gets a standard highlight method by inverting
  351.  *                         the gadget area.
  352.  *
  353.  *     - STD_HIGHLIGHT   : Gadget gets a standard highlight methode, a 3D
  354.  *                         border.
  355.  *
  356.  *                         The STD_COMPLEMENT and STD_HIGHLIGHT
  357.  *                         flags should not be set if you use a
  358.  *                         IntuiGfx Prg for render the Gadget if the user
  359.  *                         Relese or Select the Gadgets.
  360.  *
  361.  *   .Type          : Gadget's type.
  362.  *   .HotKey        : Character that the user can use to activate/toggle..
  363.  *                    the gadget. A null byte stands for no activating key.
  364.  *   .Call          : Function called before the gadget sends its message.
  365.  *                    The function gets a message pointer in A1 and may change
  366.  *                    the message to its gusto.  If the message's EIDCMP flags
  367.  *                    are cleared, the message is not sent.
  368.  *   .UserData      : Free for user data.
  369.  *
  370.  *
  371.  * BoolGadget:
  372.  *
  373.  *   .Flag          : Flag set or cleared corresponding to the gadget state.
  374.  *   .Exclude,
  375.  *   .Include       : Arrays of pointer to boolgadgets, that shall change their
  376.  *                    state if this gadget is activated.
  377.  *                    The system decates if there is a pointer to the Gadget ifself
  378.  *                    in the GadgetArray, so that you need only one GadgetArray for
  379.  *                    all gadgets which should be excluded.
  380.  *
  381.  * StringGadget:
  382.  *
  383.  *   .Buffer        : Pointer to a buffer containing the text. The text
  384.  *                    terminates with a null byte and can be read from this
  385.  *                    buffer after processing.
  386.  *   .UndoBuffer    : Pointer to undo buffer. The undo buffer must be at
  387.  *                    least as big as the original buffer. Selecting the
  388.  *                    gadget copies the buffer's contents into the undo
  389.  *                    buffer.  By pressing Amiga-O the undo buffer is copied
  390.  *                    into the original buffer.
  391.  *   .BufferPos     : Cursor posititon in the text buffer.
  392.  *   .MaxChars      : Maximum characters in the buffer.
  393.  *   .numChars      : Contains during and after processing the number of
  394.  *                    characters in the buffer.
  395.  *   .UndoPos       : Cursor position in the undo buffer.
  396.  *
  397.  *   .Justify       : Specifies if the text is to appear on the left, right
  398.  *                    or in the center of the gadget box.
  399.  *   .Font          : EFont to use for editing, must be non proportional
  400.  *
  401.  *
  402.  *  The programs "select" and "release" have no function for string gadgets
  403.  *  as then the activity is indicated by the visible cursor.
  404.  *
  405.  *
  406.  * PropGadget:
  407.  *
  408.  *   .Propflags     : Gadget flags:
  409.  *
  410.  *     - PROP_HORIZ      : Gadget moves horizontally if this bit is set, else
  411.  *                         vertically.
  412.  *     - PROP_FOLLOW     : The program gest a new message each time the knob
  413.  *                         moves. You should use this flag with care as
  414.  *                         messages are sent frequently.
  415.  *     - PROP_BORDER     : The gadget is resized automatically if the window
  416.  *                         is resized.
  417.  *     - PROP_MOVES      : The gadget's knob is currently being moved.
  418.  *
  419.  *
  420.  *   .Maximum       : Maximum gadget value.
  421.  *   .Size          : Knob size in gadget units.
  422.  *   .Value         : Value of the gadget.
  423.  *
  424.  *  The programs "active"/"passive" should draw the gadget border.
  425.  *  The programs "select"/"release" are called to draw the knob and are passed
  426.  *  over the knob width (the knob height for vertical PropGadgets).
  427.  *  Example: .maximum contains 1000.  Then .value and .size must be in the
  428.  *  range from 0 to 1000.  If one fifth of the data is visible, then .size
  429.  *  is 1000/5 = 200 and the maximum value for .value is 800.
  430.  *
  431.  *
  432.  * IntegerGadget, RealGadget:
  433.  *
  434.  *   .Value         : Value after editing is finished.
  435.  *   .Valid         : Flag set after editing is finished.
  436.  *
  437.  *
  438.  * UserGadget:
  439.  *
  440.  *   SelectCall     : Function to be called, when the gadget is selected,
  441.  *                    or NULL for no call, same parameters as .call.
  442.  *   ReleaseCall    : Function to be called, if the gadget is released,
  443.  *                    or NULL for no call, same parameters as .call.
  444.  *   ActionCall     : Function to be called, when the gadget is active and
  445.  *                    and event specified in .callFlags occurs.
  446.  *
  447.  * MasterGadget:
  448.  *
  449.  *   MasterType     : Custom type identifier for this gadget.
  450.  *   FirstSon       : Pointer to first secondary gadget
  451.  *   NumSons        : Number of secondary gadgets
  452.  *
  453.  *
  454.  */
  455.  
  456. /* Corresponding GadgetFlagSet has 16 bits ! */
  457.  
  458. #define EI_GADGET_BORDER    (1<<0)
  459. #define EI_REL_RIGHT        (1<<1)
  460. #define EI_REL_BOTTOM       (1<<2)
  461. #define EI_SYS_GADGET       (1<<3)
  462. #define EI_GADGET_SELECTED  (1<<4)
  463. #define EI_REL_VERIFY       (1<<5)
  464. #define EI_GADGET_IMMEDIATE (1<<6)
  465. #define EI_TOGGLE_SELECT    (1<<7)
  466. #define EI_REPEAT_GADGET    (1<<8)
  467. #define EI_GADGET_INACTIVE  (1<<9)
  468. #define EI_STD_HIGHLIGHT    (1<<10)
  469. #define EI_STD_COMPLEMENT   (1<<11)
  470. #define EI_OLD_SELECT       (1<<12)
  471. #define EI_CALL_ON_ELSEKEY  (1<<13)
  472. #define EI_CALL_ON_ANYKEY   (1<<14)
  473.  
  474. /* Gadget types */
  475.  
  476. #define EI_ACTION_GADGET       0
  477. #define EI_BOOL_GADGET         1
  478. #define EI_STRING_GADGET       2
  479. #define EI_PROP_GADGET         3
  480. #define EI_INTEGER_GADGET      4
  481. #define EI_USERDEF_GADGET      5
  482. #define EI_MASTER_GADGET       6
  483. #define EI_REAL_GADGET         7
  484. #define EI_DROP_GADGET         8
  485.  
  486.  
  487. typedef struct EI_Gadget *EI_GadgetPtr;
  488.  
  489. typedef APTR EI_GadgetCall;
  490.  
  491. typedef struct EI_GadgetClass *EI_GadgetClassPtr;
  492.  
  493. struct EI_Gadget {
  494.  
  495.                   EI_GadgetPtr             PrevGadget, NextGadget;
  496.  
  497.                   WORD                     CheckLeft, CheckTop,
  498.                                            LeftEdge,  TopEdge,
  499.                                            Width,     Height;
  500.  
  501.                   LONG                     GadgetID;
  502.                   IG_IntuiGfxPtr           Active, Passive,
  503.                                            Select, Release;
  504.  
  505.                   UWORD                    Flags;
  506.                   UBYTE                    GadgetType;
  507.                   char                     HotKey;
  508. /*
  509.  * You get the message in A1, and have to adhere to standard calling
  510.  * convention (A0/A1, D0/D1 are scratch).
  511.  *
  512.  */
  513.                   EI_GadgetCall            Call;
  514.                   APTR                     UserData;
  515. };
  516.  
  517. typedef struct EI_Gadget         EI_GadgetClass;
  518. typedef struct EI_BoolGadget    *EI_BoolGadPtr;
  519. typedef EI_BoolGadPtr            EI_GadgetArray;
  520. typedef EI_GadgetArray          *EI_GadgetArrayPtr;
  521.  
  522. struct EI_BoolGadget {
  523.  
  524.                   struct EI_Gadget   Class;
  525.                   UBYTE              Flag;
  526.                   UBYTE              Pad_1, Pad_2, Pad_3;
  527.                   EI_GadgetArrayPtr  Exclude, Include;
  528. };
  529.  
  530.  
  531. /* Corresponding EI_PropFlagSet has 16 bits ! */
  532.  
  533. #define EI_PROP_HORIZ           1
  534. #define EI_PROP_FOLLOW          2
  535. #define EI_PROP_MOVES           4
  536. #define EI_PROP_BORDER          8
  537. #define EI_PROP_DELTA_REFRESH   16
  538.  
  539. /* Optimized refresh (described below) */
  540.  
  541. typedef struct EI_PropGadget *EI_PropGadPtr;
  542.  
  543. struct EI_PropGadget {
  544.  
  545.                   struct EI_Gadget  Class;
  546.                   UWORD             Propflags;
  547.                   WORD              Maximum, Size, Value;
  548.                   WORD              V_height, V_pos;
  549. };
  550.  
  551. /*********************************************************
  552.  *
  553.  *  These are examples of prop-gadget IntuiGfx programs for
  554.  *  rendering.
  555.  *
  556.  *  The PropBorder program must then be put in the field called
  557.  *  Active. This program renders the full border of the gadget
  558.  *  and clears the interior.
  559.  *
  560.  *  IG_IntuiGfx PropBorder[] = {
  561.  *      IG_Const-1,IG_Const-1,IG_Move,
  562.  *      IG_CNormal,IG_CLight,IG_CDark,
  563.  *      IG_GETFI+1,IG_ADDI+2,
  564.  *      IG_GETFI+0,IG_ADDI+2,
  565.  *      IG_Rect3d,IG_RTF+2 };
  566.  *
  567.  *  These are the knob programs for verical and horizontal prop-gadgets,
  568.  *  respectively. They are put into the Select field in the EI_Gadget
  569.  *  structure.
  570.  *
  571.  *  IG_IntuiGfx VPropKnobb[] = {
  572.  *      IG_CNormal, IG_CDark,   IG_CLight,
  573.  *      IG_GETFI+1, IG_GETFI+0,
  574.  *      IG_Rect3d,
  575.  *      IG_RTF+2 };
  576.  *
  577.  *  IG_IntuiGfx HPropKnobb[] = {
  578.  *      IG_CNormal, IG_CDark, IG_CLight,
  579.  *      IG_GETFI+0, IG_GETFI+1,
  580.  *      IG_Rect3d,  IG_RTF+2 };
  581.  *
  582.  *  If you want an optimized refresh for the knob, you have to set
  583.  *  the flag EI_PROP_DELTA_REFRESH and put a program into the Release
  584.  *  field. The program PropDeltaB[] below is an example of this.
  585.  *
  586.  *  IG_IntuiGfx PropDeltaB[] = {
  587.  *      IG_CNormal, IG_Color,
  588.  *      IG_GETFI+1, IG_GETFI+0,
  589.  *      IG_Box,     IG_RTF+2 };
  590.  *
  591.  *
  592.  **********************************************************/
  593.  
  594. /* Enumeration type EI_StringJustify has 8 bits ! */
  595.  
  596. #define EI_JUSTIFY_LEFT   0
  597. #define EI_JUSTIFY_RIGHT  1
  598. #define EI_JUSTIFY_CENTER 2
  599.  
  600. typedef struct EI_StringGadget *EI_StringGadPtr;
  601.  
  602. struct EI_StringGadget {
  603.  
  604.                   struct EI_Gadget   Class;
  605.                   char              *Buffer, *UndoBuffer;
  606.                   WORD               BufferPos, MaxChars,
  607.                                      DispPos, UndoPos,
  608.                                      NumChars, DispCount,
  609.                                      DispFront;
  610.                   WORD               CLeft, CTop;
  611.                   UBYTE              Justify;
  612.                   UBYTE              Pad;
  613.                   EG_EFontPtr        Font;
  614. };
  615.  
  616. typedef struct EI_IntGadget *EI_IntGadPtr;
  617.  
  618. struct EI_IntGadget {
  619.                    struct EI_StringGadget  SG;
  620.                    LONG                    Value;
  621.                    UBYTE                   Valid;
  622.                    UBYTE                   Pad;
  623. };
  624.  
  625. typedef struct EI_UserGadget *EI_UserGadPtr;
  626.  
  627. struct EI_UserGadget {
  628.  
  629.                    struct EI_Gadget  Class;
  630.                    EI_GadgetCall     SelectCall,
  631.                                      ReleaseCall,
  632.                                      ActionCall,
  633.                                      InitCall;
  634.               /* IDCMPFlags to respond to for ActionCall: */
  635.                    ULONG             CallFlags;
  636. };
  637.  
  638. /*
  639.  * SelectCall,ReleaseCall:
  640.  *
  641.  * You get the message in A1, and have to adhere to standard calling
  642.  * convention (A0/A1, D0/D1 are scratch).
  643.  *
  644.  * ActionCall:
  645.  *
  646.  * You get the message in A1, your gadget in A2
  647.  *
  648.  * InitCall:
  649.  *
  650.  * You get your window in A1, your gadget in A0
  651.  *
  652.  */
  653.  
  654. typedef struct EI_MasterGadget *EI_MasterGadPtr;
  655.  
  656. struct EI_MasterGadget {
  657.  
  658.                     struct EI_Gadget  Class;
  659.                     LONG              MasterType;
  660.                     EI_GadgetPtr      FirstSon;
  661.                     WORD              NumSons;
  662.                     WORD              Pad;
  663. };
  664.  
  665. typedef struct EI_RealGadget *EI_RealGadPtr;
  666.  
  667. struct EI_RealGadget {
  668.                     struct EI_StringGadget SG;
  669.                     double                 Value;
  670.                     UBYTE                  Valid;
  671.                     UBYTE                  Pad;
  672. };
  673.  
  674. /*
  675.  *  Drop Gadget
  676.  */
  677.  
  678. /* Corresponding DropGadgetFlagSet has 32 bits ! */
  679.  
  680. #define EI_ACCEPTS_FILES    (1<<0)
  681. #define EI_ACCEPT_FILE      (1<<1)
  682. #define EI_ACCEPTS_CLIP     (1<<2)
  683. #define EI_ACCEPTS_DATA     (1<<3)
  684. #define EI_FULL_WINDOWSIZE  (1<<4)
  685.  
  686.  
  687. typedef struct EI_DropGadget *EI_DropGadPtr;
  688.  
  689. struct EI_DropAcceptor {
  690.                       LONG            Key;
  691.                       E_EMousePtr     Mouse;
  692. };
  693.  
  694. typedef struct EI_DropAcceptor *EI_AcceptList[];
  695. typedef EI_AcceptList          *EI_AcceptListPtr;
  696.  
  697. struct EI_DropGadget {
  698.                       ULONG            DropFlags;
  699.                       EI_AcceptListPtr Accepts;
  700. };
  701.  
  702. /*
  703.  * Screens
  704.  *
  705.  * Screens are logical successors of the EGS "EScreens". They are extended
  706.  * by fields for window and layer support.
  707.  *
  708.  * If no windows are needed it does not pay to use the screens from this
  709.  * module as they have some overhead. Moreover, EGSIntui screens cannot
  710.  * catch and redirect events.
  711.  *
  712.  *---------------------------------------------------------------------------
  713.  *
  714.  * Structures:
  715.  *
  716.  * NewScreen
  717.  *
  718.  *   .Mode        : Screen mode, refer to EGS library.
  719.  *   .Depth       : Screen depth, refer to EGS library.
  720.  *   .Title       : Screen title appearing in the title bar.
  721.  *   .Colors      : Screen colors, refer to EGS library.
  722.  *   .WinColors   : Recommended colors for windows.
  723.  *   .BackPen     : Screen background pen.
  724.  *   .BackPattern : Background pattern or picture for the screen.
  725.  *   .Mouse       : Standard mouse pointer for the screen.
  726.  *   .Font        : Font for screens and windows titlebar, if NULL the
  727.  *                  default fonts are used
  728.  *   .Flags       : The new screens screenflags
  729.  *
  730.  * Screen,ScreenPtr
  731.  *
  732.  *   .Front,
  733.  *   .Back        : Chaining.
  734.  *   .EScreen     : Pointer to the EScreen structure.
  735.  *   .FirstWindow
  736.  *   .LastWindow  : Pointer to the screen's windows.
  737.  *   .RastPort    : Screen RastPort.
  738.  *   .Info        : Pointer to LayerInfo structure.
  739.  *   .BarLayer    : Pointer to layer of the title bar.
  740.  *   .BarRast     : Pointer to screen's RastPort.
  741.  *   .WinColors   : Recommended window colors of the screen.
  742.  *   .Width       : Screen width.
  743.  *   .Height      : Screen height.
  744.  *   .Title       : Pointer to screen title string (beware, a Cluster string).
  745.  *   .Mouse       : Pointer to standard mouse pointer of screen.
  746.  *   .Font        : The title font of the screen
  747.  *   .Flags       : The screens flags
  748.  *
  749.  */
  750.  
  751. typedef APTR EI_ColorLock;
  752. typedef APTR EI_ColorTablePtr;
  753.  
  754. /* Corresponding EI_ScreenFlagSet has 8 bits */
  755.  
  756. #define EI_SCREENQUIET  1
  757. #define EI_SCREENBEHIND 2
  758.  
  759.  
  760. struct EI_NewScreen {
  761.                 char                 *Mode;
  762.                 WORD                  Depth;
  763.                 UWORD                 Pad0;
  764.                 char                 *Title;
  765.                 E_CLUPtr              Colors;
  766.                 struct IG_WinColors   WinColors;
  767.                 LONG                  BackPen;
  768.                 E_EBitMapPtr          BackPattern;
  769.                 E_EMousePtr           Mouse;
  770.                 struct TextAttr      *Font;
  771.                 UBYTE                 Flags;
  772.                 UBYTE                 Pad1;
  773. };
  774.  
  775. typedef struct EI_Screen *EI_ScreenPtr;
  776. typedef struct EI_NewScreen *EI_NewScreenPtr;
  777.  
  778. struct EI_Screen {
  779.                 EI_ScreenPtr          Front, Back;
  780.                 E_EScreenPtr          EScreen;
  781.                 EI_WindowPtr          FirstWindow, LastWindow;
  782.                 EG_RastPortPtr        RastPort;
  783.                 EL_LayerInfoPtr       LayerInfo;
  784.                 EL_LayerPtr           BarLayer;
  785.                 EG_RastPortPtr        BarRast;
  786.                 struct IG_WinColors   WinColors;
  787.                 WORD                  Width, Height;
  788.                 APTR                  Title;
  789.                 E_EMousePtr           Mouse;
  790.                 EG_EFontPtr           Font;
  791.                 WORD                  GadSize;
  792.                 UWORD                 Pad1;
  793.                 APTR                  GadImages;
  794.                 UBYTE                 Flags;
  795.                 UBYTE                 Pad2,Pad3,Pad4;
  796.                 EG_EFontPtr           WindowFont;
  797.                 APTR                  SGadImage;
  798.                 EI_ColorTablePtr      Colors;
  799.                 EI_ColorLock          ColorLock;
  800.                 APTR                  UpGadImages;
  801. };
  802.  
  803.  
  804.  
  805. /*
  806.  * Colortags
  807.  */
  808.  
  809. #define EI_CTAGBASE                    0x80010000
  810. #define EIC_SCREEN_BACKPEN            (EI_CTAGBASE+0x00)
  811. #define EIC_WINDOW_BACKPEN            (EI_CTAGBASE+0x01)
  812. #define EIC_UNKNWON_PEN               (EI_CTAGBASE+0x02)
  813. #define EIC_TEXT_FRONT_PEN            (EI_CTAGBASE+0x03)
  814. #define EIC_TEXT_BACK_PEN             (EI_CTAGBASE+0x04)
  815. #define EIC_SCREENLIGHT               (EI_CTAGBASE+0x05)
  816. #define EIC_SCREEN_PEN                (EI_CTAGBASE+0x06)
  817. #define EIC_SCREEN_DARK               (EI_CTAGBASE+0x07)
  818. #define EIC_SCREEN_TEXT               (EI_CTAGBASE+0x08)
  819. #define EIC_WIN_LIGHT                 (EI_CTAGBASE+0x09)
  820. #define EIC_WIN_PEN                   (EI_CTAGBASE+0x0A)
  821. #define EIC_WIN_DARK                  (EI_CTAGBASE+0x0B)
  822. #define EIC_WIN_TEXT                  (EI_CTAGBASE+0x0C)
  823. #define EIC_WIN_ACTIVE_LIGHT          (EI_CTAGBASE+0x0D)
  824. #define EIC_WIN_ACTIVE_PEN            (EI_CTAGBASE+0x0E)
  825. #define EIC_WIN_ACTIVE_DARK           (EI_CTAGBASE+0x0F)
  826. #define EIC_WIN_ACTIVE_TEXT           (EI_CTAGBASE+0x10)
  827. #define EIC_WIN_SLEEP_LIGHT           (EI_CTAGBASE+0x11)
  828. #define EIC_WIN_SLEEP_PEN             (EI_CTAGBASE+0x12)
  829. #define EIC_WIN_SLEEP_DARK            (EI_CTAGBASE+0x13)
  830. #define EIC_WIN_SLEEP_TEXT            (EI_CTAGBASE+0x14)
  831. #define EIC_GADGET_LIGHT              (EI_CTAGBASE+0x15)
  832. #define EIC_GADGET_PEN                (EI_CTAGBASE+0x16)
  833. #define EIC_GADGET_DARK               (EI_CTAGBASE+0x17)
  834. #define EIC_GADGET_TEXT               (EI_CTAGBASE+0x18)
  835. #define EIC_GADGET_SEL_LIGHT          (EI_CTAGBASE+0x19)
  836. #define EIC_GADGET_SEL_PEN            (EI_CTAGBASE+0x1A)
  837. #define EIC_GADGET_SEL_DARK           (EI_CTAGBASE+0x1B)
  838. #define EIC_GADGET_SEL_TEXT           (EI_CTAGBASE+0x1C)
  839. #define EIC_TEXT_GADGET_FRONT         (EI_CTAGBASE+0x1D)
  840. #define EIC_TEXT_GADGET_BACK          (EI_CTAGBASE+0x1E)
  841. #define EIC_PROP_LIGHT                (EI_CTAGBASE+0x1F)
  842. #define EIC_PROP_PEN                  (EI_CTAGBASE+0x20)
  843. #define EIC_PROP_DARK                 (EI_CTAGBASE+0x21)
  844. #define EIC_KNOB_LIGHT                (EI_CTAGBASE+0x22)
  845. #define EIC_KNOB_PEN                  (EI_CTAGBASE+0x23)
  846. #define EIC_KNOB_DARK                 (EI_CTAGBASE+0x24)
  847. #define EIC_MENU_LIGHT                (EI_CTAGBASE+0x25)
  848. #define EIC_MENU_PEN                  (EI_CTAGBASE+0x26)
  849. #define EIC_MENU_DARK                 (EI_CTAGBASE+0x27)
  850. #define EIC_MENU_TEXT                 (EI_CTAGBASE+0x28)
  851. #define EIC_MENU_SEL_LIGHT            (EI_CTAGBASE+0x29)
  852. #define EIC_MENU_SEL_PEN              (EI_CTAGBASE+0x2A)
  853. #define EIC_MENU_SEL_DARK             (EI_CTAGBASE+0x2B)
  854. #define EIC_MENU_SEL_TEXT             (EI_CTAGBASE+0x2C)
  855. #define EIC_MASTER_LIGHT              (EI_CTAGBASE+0x2D)
  856. #define EIC_MASTER_PEN                (EI_CTAGBASE+0x2E)
  857. #define EIC_MASTER_DARK               (EI_CTAGBASE+0x2F)
  858. #define EIC_MASTER_TEXT               (EI_CTAGBASE+0x30)
  859. #define EIC_WIN_GADGET_LIGHT          (EI_CTAGBASE+0x31)
  860. #define EIC_WIN_GADGET_DARK           (EI_CTAGBASE+0x32)
  861. #define EIC_WIN_GADGET_BACK           (EI_CTAGBASE+0x33)
  862. #define EIC_WIN_GADGET_PEN            (EI_CTAGBASE+0x34)
  863. #define EIC_TEXT_SELECT_FRONT_PEN     (EI_CTAGBASE+0x35)
  864. #define EIC_TEXT_SELECT_BACK_PEN      (EI_CTAGBASE+0x36)
  865. #define EIC_CURSOR_FRONT_PEN          (EI_CTAGBASE+0x37)
  866. #define EIC_CURSOR_BACK_PEN           (EI_CTAGBASE+0x38)
  867. #define EIC_CURSOR_SELECT_FRONT_PEN   (EI_CTAGBASE+0x39)
  868. #define EIC_CURSOR_SELECT_BACK_PEN    (EI_CTAGBASE+0x3A)
  869. #define EIC_CURSOR_INACTIVE_FRONT_PEN (EI_CTAGBASE+0x3B)
  870. #define EIC_CURSOR_INACTIVE_BACK_PEN  (EI_CTAGBASE+0x3C)
  871.  
  872. /*
  873. **
  874. ** Mouse define for EI_GetPrefPointer
  875. **
  876. */
  877.  
  878. #define EI_MTAGBASE             0x80020000
  879. #define EIM_STANDARD_MOUSE     (EI_MTAGBASE+0x00)
  880. #define EIM_SLEEP_MOUSE        (EI_MTAGBASE+0x01)
  881. #define EIM_WAIT_MOUSE         (EI_MTAGBASE+0x02)
  882. #define EIM_DISK_READ_MOUSE    (EI_MTAGBASE+0x03)
  883. #define EIM_DISK_WRITE_MOUSE   (EI_MTAGBASE+0x04)
  884. #define EIM_DISKIO_MOUSE       (EI_MTAGBASE+0x05)
  885. #define EIM_WORKING_MOUSE      (EI_MTAGBASE+0x06)
  886. #define EIM_PLAY_MACRO_MOUSE   (EI_MTAGBASE+0x07)
  887. #define EIM_PRINTING_MOUSE     (EI_MTAGBASE+0x08)
  888. #define EIM_SEARCHING_MOUSE    (EI_MTAGBASE+0x09)
  889. #define EIM_FROZEN_MOUSE       (EI_MTAGBASE+0x0A)
  890. #define EIM_COPY_MOUSE         (EI_MTAGBASE+0x0B)
  891. #define EIM_SWAP_MOUSE         (EI_MTAGBASE+0x0C)
  892. #define EIM_MOVE_MOUSE         (EI_MTAGBASE+0x0D)
  893. #define EIM_SELECT_MOUSE       (EI_MTAGBASE+0x0E)
  894. #define EIM_ZOOM_MOUSE         (EI_MTAGBASE+0x0F)
  895. #define EIM_FILL_MOUSE         (EI_MTAGBASE+0x10)
  896. #define EIM_PASTE_MOUSE        (EI_MTAGBASE+0x11)
  897. #define EIM_CUT_MOUSE          (EI_MTAGBASE+0x12)
  898. #define EIM_RECORD_MACRO_MOUSE (EI_MTAGBASE+0x13)
  899. #define EIM_CROSSHAIR_MOUSE    (EI_MTAGBASE+0x14)
  900. #define EIM_SIZE_MOUSE         (EI_MTAGBASE+0x15)
  901. #define EIM_TEXT_MOUSE         (EI_MTAGBASE+0x16)
  902. #define EIM_AIRBRUSH_MOUSE     (EI_MTAGBASE+0x17)
  903. #define EIM_PICK_MOUSE         (EI_MTAGBASE+0x18)
  904. #define EIM_DRAW_MOUSE         (EI_MTAGBASE+0x19)
  905. #define EIM_PAINT_MOUSE        (EI_MTAGBASE+0x1A)
  906. #define EIM_SELECT_TO_MOUSE    (EI_MTAGBASE+0x1B)
  907. #define EIM_RANGE_MOUSE        (EI_MTAGBASE+0x1C)
  908. #define EIM_CLICK_MOUSE        (EI_MTAGBASE+0x1D)
  909. #define EIM_ROTATE_MOUSE       (EI_MTAGBASE+0x1E)
  910.  
  911. /*
  912.  * Windows
  913.  *
  914.  * Windows use layers, RastPorts and screens. They are the super structure
  915.  * of gadgets and menus. If required, they send messages about user actions
  916.  * and other events.
  917.  *
  918.  * A window consists of one or two layers (GimmeZeroZero). The overhead of
  919.  * the second layer is not as big as to destroy the advantage of automatic
  920.  * clipping. Only simple requester windows without a sizing gadget should
  921.  * be implemented with one-layered windows.
  922.  *
  923.  * Windows can have a render program being executed automatically at refresh
  924.  * by the library. This frees the program from refreshing constant graphics
  925.  * elements.
  926.  *
  927.  *---------------------------------------------------------------------------
  928.  *
  929.  * Structures:
  930.  *
  931.  * EIntuiMsg, EIntuiMsgPtr
  932.  *
  933.  *   .class      : Type of message:
  934.  *
  935.  *     - iMOUSEBUTTONS  : Mouse button message; which button and whether
  936.  *                        pressed or released is contained in the code field.
  937.  *     - iMOUSEMOVE     : Mouse movement.
  938.  *     - iRAWKEY        : "Raw" key message, i.e. scan code and qualifier.
  939.  *                        If VanillaKey is also selected, normal key are
  940.  *                        reported as Vanillakey and control keys as RawKey
  941.  *                        message (like 2.0).
  942.  *     - iACTIVATE      : Window was activated.
  943.  *     - iWINDOWREFRESH : Window wants a refresh, the refresh key (refer to
  944.  *                        EGSLayers) is in the field "iAddress".
  945.  *     - iCLOSEWINDOW   : User has clicked onto the close gadget.
  946.  *     - iNEWSIZE       : Window was resized.
  947.  *     - iMENUPICK      : Menu item has been selected.
  948.  *     - iGADGETUP      : Gadget was selected.
  949.  *     - iVANILLAKEY    : Message about translated key press, the ASCII code
  950.  *                        of the key is in the code field.
  951.  *     - iSIZEVERIFY    : If the user tries to resize the window, a SizeVerify
  952.  *                        message is sent.  EGSIntui waits until the message
  953.  *                        is replied.  The program can cancel the sizing
  954.  *                        action with the corresponding message in the code
  955.  *                        field.
  956.  *     - iDISKINSERTED  : Self-explanatory.
  957.  *     - iDISKREMOVED   : Self-explanatory.
  958.  *     - iNEWPREFS      : The Amiga preferences were changed.
  959.  *
  960.  *   .Code       : Additional information about the message.
  961.  *   .Qualifier  : State of the qualifiers (shift etc.) when the event was
  962.  *                 sent.
  963.  *   .IAddress   : Address of the structure that caused the event (gadget or
  964.  *                 menu).
  965.  *   .MouseX,
  966.  *   .MouseY     : Mouse position at event time, relative to top left corner
  967.  *                 of the window.
  968.  *   .Seconds,
  969.  *   .Micros     : Event time.
  970.  *   .IDCMPWindow: Window sending the message.
  971.  *
  972.  * NewWindow
  973.  *
  974.  *   .LeftEdge,
  975.  *   .TopEdge    : Top left window corner.
  976.  *   .Width,
  977.  *   .Height     : Size of window's contents.
  978.  *   .MinWidth,
  979.  *   .MinHeight  : Minimum window size.
  980.  *   .MaxWidth,
  981.  *   .MaxHeight  : Maximum window size.
  982.  *   .Screen     : Screen on which the window shall open.  If NULL is speci-
  983.  *                 fied, the window is opened on a standard screen.  The
  984.  *                 program should make no assumptions regarding the screen,
  985.  *                 neither size nor depth.
  986.  *   .SysGadgets : System gadgets of the window:
  987.  *
  988.  *     - WINDOWCLOSE     : Close gadget.
  989.  *     - WINDOWSIZE      : Size gadget in the bottom right corner.
  990.  *     - WINDOWFRONT     : Gadget for window-to-front.
  991.  *     - WINDOWBACK      : Gadget for window-to-back; if only one of both
  992.  *                         gadgets is there it serves for both purposes just
  993.  *                         like Kick 2.0.
  994.  *     - WINDOWFLIP      : Flipping between two positions and sizes like
  995.  *                         Kick 2.0.
  996.  *     - WINDOWBIG       : Gadget for maximum size.
  997.  *     - WINDOWSMALL     : Gadget for minimum size.
  998.  *     - WINDOWICON      : Iconify.
  999.  *     - WINDOWARROWL,
  1000.  *     - WINDOWARROWR,
  1001.  *     - WINDOWARROWU,
  1002.  *     - WINDOWARROWD    : Arrows for scrolling gadgets.
  1003.  *     - WINDOWSCROLLH,
  1004.  *     - WINDOWSCROLLV   : Scrolling gadgets for the window.
  1005.  *     - WINDOWDRAG      : Dragging gadget.
  1006.  *
  1007.  *   .Gadgets    : List of gadgets that the window is to have from the
  1008.  *                 beginning.
  1009.  *   .Name       : Window title.
  1010.  *   .Flags      : Window flags
  1011.  *
  1012.  *     - GIMMEZEROZERO   : GZZ window with two layers and extra RastPort for
  1013.  *                         inner area and the border.
  1014.  *     - BORDERLESS      : Window has no border and cannot be moved.
  1015.  *     - SUPERBITMAP     : Window gets a SuperBitMap layer, all initializing
  1016.  *                         is done automatically, the size of the SuperBitMap
  1017.  *                         is derived from the maximum window size.
  1018.  *     - SIMPLEREFRESH   : User gets messages about refreshs.
  1019.  *     - WINDOWACTIVE    : Window is currently active.
  1020.  *     - WINDOWMENUlOCAL : Window menu is relative to the window title.
  1021.  *     - OWN_COLORPALETTE: Window has a color table on its own for its
  1022.  *                         border etc.
  1023.  *     - RMBTRAP         : If not pressed outside the window, a message is
  1024.  *                         sent for the right mouse button instead of
  1025.  *                         starting menu selection.
  1026.  *     - REPORTMOUSE     : The mouse position is in intervals written into
  1027.  *                         the window structure.  This flag is neccessary to
  1028.  *                         get MouseMove events.
  1029.  *     - BACKDROP        : The window is opened behind all other windows.
  1030.  *     - SMARTREFRESH    : The window automatically refreshes itself in most
  1031.  *                         cases apart from resizing.
  1032.  *     - WINDOWMENUPOPUP : This window's menus appear directly at the mouse
  1033.  *                         position.
  1034.  *     - SIZEBBOTTOM     : The window sizing gadget belongs only to the bottom
  1035.  *                         border.
  1036.  *     - SIZEBRIGHT      : The window sizing gadget belongs only to the right
  1037.  *                         border.
  1038.  *     - WINDOW_USERSTYLE: The window has its own rendering routine for its
  1039.  *                         borders and gadgets
  1040.  *     - ACTIVETOFRONT   : The window always comes to the front, when it is
  1041.  *                         activated.
  1042.  *     - QUICKSCROLL     : The window offset follows immediately the scroll-
  1043.  *                         ing gadgets
  1044.  *     - FIXWINDOW_RATIO : The window keeps the width/height ratio according
  1045.  *                         to the maximum size, when resized by the user.
  1046.  *
  1047.  *   .IDCMPFlags : Events to be sent by the window.
  1048.  *   .UserPort   : Pointer to a message port for user actions.  If the pointer
  1049.  *                 is NULL the library creates an extra port and removes that
  1050.  *                 port when closing the window.
  1051.  *   .Colors     : Own color table for border and text.
  1052.  *   .MenuStrip  : Pointer to window menu.
  1053.  *   .Render     : Render program to draw the standard window contents.
  1054.  *
  1055.  * Window, WindowPtr
  1056.  *
  1057.  *   .LeftEdge,
  1058.  *   .TopEdge    : Top left window corner.
  1059.  *   .Width,
  1060.  *   .Height     : Size of the inner window parts.
  1061.  *   .LeftBorder,
  1062.  *   .TopBorder,
  1063.  *   .RightBorder,
  1064.  *   .BottomBorder : Width or height of the window border.
  1065.  *   .RPort      : RastPort of the window contents.
  1066.  *   .Layer      : Layer of the window.
  1067.  *   .Screen     : Pointer to the window's screen.
  1068.  *   .MouseX,
  1069.  *   .MouseY     : The mouse position relative to the top left window edge
  1070.  *   .UserPort   : The windows message port
  1071.  */
  1072.  
  1073. /* Corresponding EI_SysGadgetSet has 32 bits ! */
  1074.  
  1075. #define EI_WINDOWCLOSE   (1<<0)
  1076. #define EI_WINDOWSIZE    (1<<1)
  1077. #define EI_WINDOWFRONT   (1<<2)
  1078. #define EI_WINDOWBACK    (1<<3)
  1079. #define EI_WINDOWFLIP    (1<<4)
  1080. #define EI_WINDOWBIG     (1<<5)
  1081. #define EI_WINDOWSMALL   (1<<6)
  1082. #define EI_WINDOWICON    (1<<7)
  1083. #define EI_WINDOWARROWL  (1<<8)
  1084. #define EI_WINDOWARROWR  (1<<9)
  1085. #define EI_WINDOWARROWU  (1<<10)
  1086. #define EI_WINDOWARROWD  (1<<11)
  1087. #define EI_WINDOWSCROLLH (1<<12)
  1088. #define EI_WINDOWSCROLLV (1<<13)
  1089. #define EI_WINDOWDRAG    (1<<14)
  1090.  
  1091. /* Corresponding EI_WindowFlagSet has 32 bits ! */
  1092.  
  1093. #define EI_GIMMEZEROZERO     (1<<0)
  1094. #define EI_BORDERLESS        (1<<1)
  1095. #define EI_SUPER_BITMAP      (1<<2)
  1096. #define EI_SIMPLE_REFRESH    (1<<3)
  1097. #define EI_WINDOWREFRESH     (1<<4)
  1098. #define EI_WINDOWACTIVE      (1<<5)
  1099. #define EI_WINDOW_MENULOCAL  (1<<6)
  1100. #define EI_OWN_IDCMPPORT     (1<<7)
  1101. #define EI_OWN_COLORPALETTE  (1<<8)
  1102. #define EI_FRONTBACKGADGET   (1<<9)
  1103. #define EI_RMBTRAP           (1<<10)
  1104. #define EI_REPORTMOUSE       (1<<11)
  1105. #define EI_BACKDROP          (1<<12)
  1106. #define EI_SMART_REFRESH     (1<<13)
  1107. #define EI_WINDOW_MENUPOPUP  (1<<14)
  1108. #define EI_SIZEBBOTTOM       (1<<15)
  1109. #define EI_SIZEBRIGHT        (1<<16)
  1110. #define EI_WINDOW_USERSTYLE  (1<<17)
  1111. #define EI_ACTIVETOFRONT     (1<<18)
  1112. #define EI_QUICKSCROLL       (1<<19)
  1113. #define EI_WINDOW_SLEEPING   (1<<20)
  1114. #define EI_FIXWINDOW_RATIO   (1<<21)
  1115. #define EI_FORCE_TO_SCREEN   (1<<22)
  1116. #define EI_WINDOWCENTER      (1<<23)
  1117. #define EI_SEND_OUTSIDEMOVES (1<<24)
  1118. #define EI_MIGRATEABLE       (1<<25)
  1119.  
  1120. /* Corresponding EI_EIDCMPFlagSet has 32 bits ! */
  1121.  
  1122. #define EI_iMOUSEBUTTONS   (1<<0)
  1123. #define EI_iMOUSEMOVE      (1<<1)
  1124. #define EI_iRAWKEY         (1<<2)
  1125. #define EI_iACTIVEWINDOW   (1<<3)
  1126. #define EI_iREFRESHWINDOW  (1<<4)
  1127. #define EI_iCLOSEWINDOW    (1<<5)
  1128. #define EI_iNEWSIZE        (1<<6)
  1129. #define EI_iMENUPICK       (1<<7)
  1130. #define EI_iGADGETDOWN     (1<<8)
  1131. #define EI_iGADGETUP       (1<<8)
  1132. #define EI_iMENUVERIFY     (1<<9)
  1133. #define EI_iVANILLAKEY     (1<<10)
  1134. #define EI_iSIZEVERIFY     (1<<11)
  1135. #define EI_iINACTIVEWINDOW (1<<12)
  1136. #define EI_iINTUITICKS     (1<<13)
  1137. #define EI_iDISKINSERT     (1<<14)
  1138. #define EI_iDISKREMOVE     (1<<15)
  1139. #define EI_iNEWPREFS       (1<<16)
  1140. #define EI_iMOVEWINDOW     (1<<17)
  1141. #define EI_iDROP           (1<<18)
  1142. #define EI_iMIGRATEVERIFY  (1<<19)
  1143. #define EI_iMIGRATE        (1<<20)
  1144.  
  1145. struct EI_Window {
  1146.                  EI_WindowPtr         Front, Back,
  1147.                                       Prev, Next, OldActive;
  1148.                  WORD                 LeftEdge, TopEdge,
  1149.                                       Width, Height;
  1150.                  WORD                 BorderLeft, BorderTop,
  1151.                                       BorderRight, BorderBottom;
  1152.                  WORD                 FullWidth, FullHeight;
  1153.                  WORD                 LeftUsed, RightUsed;
  1154.                  WORD                 MouseX, MouseY;
  1155.                  EG_RastPortPtr       RPort;
  1156.                  EL_LayerPtr          WLayer;
  1157.                  EI_ScreenPtr         WScreen;
  1158.                  EG_RastPortPtr       BorderRPort;
  1159.                  EL_LayerPtr          BorderLayer;
  1160.                  ULONG                Flags;
  1161.                  ULONG                IDCMPFlags;
  1162.                  struct MsgPort      *UserPort;
  1163.                  EI_GadgetPtr         FirstGadget;
  1164.                  EB_ColorTable        GadColors [5];
  1165.                  struct IG_WinColors  WinColors;
  1166.                  APTR                 Tile, ScrTitel;
  1167.                  IG_IntuiGfxPtr       Border, Render;
  1168.                  EI_MenuPtr           OuterMenu, MenuStrip;
  1169.                  E_EMousePtr          Pointer;
  1170.                  WORD                 MinWidth, MinHeight,
  1171.                                       MaxWidth, MaxHeight;
  1172.                  WORD                 FlipWidth, FlipHeight,
  1173.                                       FlipLeft, FlipTop;
  1174.                  EG_EFontPtr          EFont;
  1175.                  APTR                 UserData;
  1176.                  EI_ColorTablePtr     Colors;
  1177.                  LONG                 SleepCount;
  1178. };
  1179.  
  1180. /*
  1181. **
  1182. ** FontTypes see EI_GetPrefFont()
  1183. **
  1184. */
  1185. #define EI_pSCREENFONT         1
  1186. #define EI_pWINDOWFONT         2
  1187. #define EI_pSYSTEMFONT         3
  1188.  
  1189.  
  1190. struct EI_EIntuiMsg {
  1191.  
  1192.                  struct   Message  ExecMessage;
  1193.                  ULONG             Class;
  1194.                  UWORD             Code;
  1195.                  WORD              Qualifier;
  1196.                  APTR              IAddress;
  1197.                  WORD              MouseX, MouseY;
  1198.                  ULONG             Seconds, Micros;
  1199.                  EI_WindowPtr      IDCMPWindow;
  1200.                  WORD              RepeatCount;  /* Number of repeated Keys */
  1201.                  WORD              Pad1;
  1202.                  LONG              DropType;      /* private */
  1203.                  APTR              DropItem;      /* private */
  1204.                  LONG              DropSize;      /* private */
  1205.                  E_TabletDataPtr   Tablet;
  1206. };
  1207.  
  1208. /*
  1209.  * EI_UserStyle
  1210.  *
  1211.  * Structure for own look window border. Uses an IntuiGfx program to draw.
  1212.  * The parameters are defined as EI_US_xxx. If an own border is given, all
  1213.  * the system gadgets have to be supplied by the programmer too.
  1214.  *
  1215.  * Example, the original EGS window border:
  1216.  *
  1217.  * {
  1218.  *  *** black surrounding     ***
  1219.  *   IG_Const24+0x000000,IG_Color,
  1220.  *   EI_US_Width,EI_US_Height,IG_Box2d,
  1221.  *  *** first outer 3d border ***
  1222.  *   IG_Const+1,IG_Const+1,IG_Locate,
  1223.  *   IG_Const24+0x000000,EI_US_Middle,
  1224.  *   EI_US_Width,IG_ADDI-2,
  1225.  *   EI_US_Height,IG_ADDI-2,IG_Box3d,
  1226.  *  *** second outer 3d border ***
  1227.  *   IG_Const+2,IG_Const+2,IG_Locate,
  1228.  *   EI_US_Dark,EI_US_Light,
  1229.  *   EI_US_Width,IG_ADDI-4,
  1230.  *   EI_US_Height,IG_ADDI-4,IG_
  1231.  *  *** first inner 3d border ***
  1232.  *   EI_US_Left,IG_ADDI-1,
  1233.  *   EI_US_Top,IG_ADDI-1,IG_Locate,
  1234.  *   EI_US_Middle,IG_Const24+0x000000,
  1235.  *   EI_US_Width,EI_US_Left,IG_SUB,EI_US_Right,IG_SUB,IG_ADDI+2,
  1236.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+2,IG_Box3d,
  1237.  *  *** second inner 3d border ***
  1238.  *   EI_US_Left,IG_ADDI-2,
  1239.  *   EI_US_Top,IG_ADDI-2,IG_Locate,
  1240.  *   EI_US_Middle,IG_Const24+0x000000,
  1241.  *   EI_US_Width,EI_US_Left,IG_SUB,EI_US_Right,IG_SUB,IG_ADDI+4,
  1242.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+4,IG_Box3d,
  1243.  *  *** filled border area, top... ***
  1244.  *   EI_US_Middle,IG_Color,
  1245.  *  *** ... top ... ***
  1246.  *   IG_Const+3,IG_Const+3,IG_Locate,
  1247.  *   EI_US_Width,IG_ADDI-6,EI_US_Top,IG_ADDI-5,IG_Box,
  1248.  *  *** ... right ... ***
  1249.  *   EI_US_Right,IG_ADDI-5,IG_DUP,
  1250.  *   IG_NEG,IG_Const+0,IG_Move,
  1251.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI-4,IG_Box,
  1252.  *  *** ... left ... ***
  1253.  *   IG_Const+3,EI_US_Top,IG_ADDI-2,IG_Locate,
  1254.  *   EI_US_Left,IG_ADDI-5,IG_DUP,
  1255.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+4,IG_Box,
  1256.  *  *** ... bottom ... ***
  1257.  *   IG_NEG,IG_Const+0,IG_Move,
  1258.  *   EI_US_Width,IG_ADDI-6,EI_US_Bottom,IG_ADDI-5,IG_Box,
  1259.  *  *** ... title ... ***
  1260.  *   EI_US_Font,IG_Font,
  1261.  *   EI_US_FHeight,IG_ADDI+7,IG_Const+6,IG_Locate,
  1262.  *   EI_US_TextColor,IG_Color,EI_US_Name,IG_Write,
  1263.  *  *** good bye ***
  1264.  *   IG_RTF+13
  1265.  *  }
  1266.  *
  1267.  */
  1268.  
  1269. typedef struct EI_UserStyle *EI_UserStylePtr;
  1270.  
  1271. #define EI_US_TEXTCOLOR    (IG_GETFI+12)  /* color of title text          */
  1272. #define EI_US_LEFT         (IG_GETFI+11)  /* width of left border         */
  1273. #define EI_US_TOP          (IG_GETFI+10)  /* height of top border         */
  1274. #define EI_US_RIGHT        (IG_GETFI+9)   /* width of right border        */
  1275. #define EI_US_BOTTOM       (IG_GETFI+8)   /* height of bottom border      */
  1276. #define EI_US_FONT         (IG_GETFI+7)   /* font of title text           */
  1277. #define EI_US_FHEIGHT      (IG_GETFI+6)   /* fontheight                   */
  1278. #define EI_US_NAME         (IG_GETFI+5)   /* title, use IG_Write          */
  1279. #define EI_US_MIDDLE       (IG_GETFI+4)   /* main border pen              */
  1280. #define EI_US_DARK         (IG_GETFI+3)   /* dark border pen              */
  1281. #define EI_US_LIGHT        (IG_GETFI+2)   /* light border pen             */
  1282. #define EI_US_WIDTH        (IG_GETFI+1)   /* full window width and height */
  1283. #define EI_US_HEIGHT       (IG_GETFI+0)   /* including the border         */
  1284.  
  1285. struct EI_UserStyle {
  1286.                 WORD          BorderLeft, BorderTop,
  1287.                               BorderRight, BorderBottom;
  1288.                IG_IntuiGfxPtr DrawBorder;
  1289. };
  1290.  
  1291.  
  1292. struct EI_NewWindow {
  1293.                  WORD             LeftEdge, TopEdge,
  1294.                                   Width, Height;
  1295.                  WORD             MinWidth, MinHeight,
  1296.                                   MaxWidth, MaxHeight;
  1297.                  EI_ScreenPtr     Screen;
  1298.  
  1299.  /* Tag for this union is hidden by WindowUserStyle flag in "flags" field */
  1300.  
  1301.                  union {
  1302.                       ULONG             SysGadgets;
  1303.                       EI_UserStylePtr   UserStyle;
  1304.  
  1305.                  } Bordef;
  1306.  
  1307.                 EI_GadgetPtr        FirstGadgets;
  1308.                 char               *Title;
  1309.                 ULONG               Flags;
  1310.                 ULONG               IDCMPFlags;
  1311.                 struct MsgPort     *Port;
  1312.                 struct IG_WinColors Colors;
  1313.                 EI_MenuPtr          Menu;
  1314.                 IG_IntuiGfxPtr      Render;
  1315. };
  1316.  
  1317. typedef struct EI_NewWindow *EI_NewWindowPtr;
  1318.  
  1319. #endif /* EGS_EGSINTUI_H */
  1320.  
  1321.  
  1322.